package com.bainaeco.framework.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum SQLMapKey {
	
	SQL("sql"),
	VALUES("values"),
	ID_NAME("id_name"),
	ID_VALUE("id_value");
	
	private String key;

	private SQLMapKey(String key) {
		this.key = key;
	}

	public String toStringValue() {
		return this.key;
	}

	public static SQLMapKey toStatus(String key) {
		if (SQL.key.equals(key)) {
			return SQL;
		} else if(VALUES.key.equals(key)){
			return VALUES;
		} else if(ID_NAME.key.equals(key)){
			return ID_NAME;
		} else if(ID_VALUE.key.equals(key)){
			return ID_VALUE;
		} else {
			throw new InvalidArgumentException("Unknown key[" + key + "].");
		}
	}
}
